package maps

/*
合并多个Map
*/
func Mix(maps []map[interface{}]interface{}) map[interface{}]interface{} {
	switch len(maps) {
	case 0:
		return nil
	case 1:
		return maps[0]
	default:
		mixMap := make(map[interface{}]interface{})
		for _, mapVal := range maps {
			for key, val := range mapVal {
				mixMap[key] = val
			}
		}
		return mixMap
	}
}

func GetKeyWithDefaultS(target map[string]string, key string, defaultValue string) string {
	if _, ok := target[key]; ok {
		return target[key]
	} else {
		return defaultValue
	}
}
